#ifndef _C_GL_TEXTURE_2D_H_
#define _C_GL_TEXTURE_2D_H_

#include "../interface/I_api_Texture_2D.h"

#include <vector>

struct cudaGraphicsResource;

class C_gl_Texture_2D : public I_api_Texture_2D
{
protected:
	struct s_mapped_resource
	{
		cudaGraphicsResource * pResource;
		i32 Subresource;
		i32	Flag;
		s_mapped_resource()
		{
			pResource = 0;
			Subresource = -1;
			Flag = 0;
		};
	};
	friend class C_gl_Device;

	u32																		m_Id;
	u32																		m_Flag;
	cudaGraphicsResource								*	m_pResource;
	std::vector<s_mapped_resource *>			m_pResourceList;

	C_gl_Texture_2D(const S_api_Texture2D_Desc *pDesc,
									const S_api_Subresource_Data *pInitialData,
									const I_api_Device * pDevice);
public:
	virtual ~C_gl_Texture_2D();

	virtual	bool	Map(u32 Subresource, E_api_Map MapType, u32 MapFlags, S_api_Mapped_Texture2D *pMappedTex2D);
	
	virtual	bool	Unmap(u32 Subresource);

	virtual	void	*	Get() { return &m_Id; }
};

#endif